package org.liang.clients.fallback;

import feign.hystrix.FallbackFactory;
import org.liang.clients.AuthClient;
import org.liang.domain.LoginUser;
import org.liang.exception.ResponseCode;
import org.liang.util.AjaxResult;
import org.springframework.stereotype.Component;

@Component
public class AuthClientFallBack implements FallbackFactory<AuthClient> {

    @Override
    public AuthClient create(Throwable throwable) {
        throwable.printStackTrace();
        return new AuthClient() {
            @Override
            public AjaxResult addOrUpdate(LoginUser loginUser) {
                return AjaxResult.me().setMessage(ResponseCode.RESPONSE_CODE_500.getMessage());
            }
        };
    }
}
